package com.gp.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * @author shijunxing
 * @className DatabaseHelper
 * @date Aug 26, 2013 9:40:44 AM
 * @version 1.0
 * @Description 数据库辅助类，主要用于建立数据库、数据表
 */
public class DatabaseHelper extends SQLiteOpenHelper{
    
    //数据库表明
	private String tableName = "record";
	
	//建表语句
	private String sqlite = "create table if not exists " + tableName +
			"(_id integer primary key autoincrement, " +
			"title varchar," +
			"content text," +
			"time varchar)";

	public DatabaseHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
	    //执行建表语句
		db.execSQL(sqlite);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}
	
}


